<!DOCTYPE html>

<html lang="en" xmlns:th="http://www.thymeleaf.org">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>虚拟仿真实验教学项目管理平台</title>

        <script type="text/javascript" src="static/js/jquery-1.8.0.min.js"></script>
        <link href="static/css/bootstrap-be665bb9f0f7fc89f515ad.css" rel="stylesheet">
		<link href="static/css/app-bbc7b0797d7724c5400c2795d973.css" rel="stylesheet">
		<link rel="stylesheet" type="text/css" href="static/css/font-awesome-d747d5b755b138af0a6.css">
		<script type="text/javascript" src="static/js/base64-b2c3d8bd2c1229c7339744dfd.js" charset="UTF-8"></script>
		<script type="text/javascript" src="static/js/jsbn-0fbf616a8a8b7a31e5694866677.js" charset="UTF-8"></script>
		<script type="text/javascript" src="static/js/prng4-e5918399f7a38295d617eb78cc.js" charset="UTF-8"></script>
		<script type="text/javascript" src="static/js/rng-015302b7d458a2d1804caceba805.js" charset="UTF-8"></script>
		<script type="text/javascript" src="static/js/rsa-850577550a13eb3b22c72912b3a6.js" charset="UTF-8"></script>
	</head>
    <script type="text/javascript" th:src="@{static/js/toastr.min.js}"></script>


    <link rel="stylesheet" th:href="@{static/css/toastr.css}"/>

    <script type="text/javascript">
        toastr.options.positionClass = 'toast-top-center';
    </script>
	<body>
		<div id="mainWrapper">
			
			<div class="login-container">
				<div class="logo">
					<img src="static/picture/logo.png">
				</div>
				<div class="login-card">
					<div class="login-form">
						<form name="loginForm" class="form-horizontal">
							
							<div class="input-group input-sm">
								<label class="input-group-addon" for="username"><i class="fa fa-user"></i></label>
								<input type="text" class="form-control" id="username" placeholder="请输入用户名/手机/邮箱" required="">
							</div>
							<div class="input-group input-sm">
								<label class="input-group-addon" for="password"><i class="fa fa-lock"></i></label> 
								<input type="password" class="form-control" id="password" autocomplete="off" placeholder="请输入密码" required="">
								<input type="hidden" id="ciphertext" name="ciphertext">
							</div>
							<div class="input-group input-sm">
<!--                              <div class="checkbox">-->
<!--                                <label><input type="checkbox" id="rememberme" name="remember-me">记住我</label>  -->
<!--                              </div>-->
							</div>
							<input type="hidden" name="_csrf" value="b07e4fce-1b85-452a-a701-85bbe4618528">
								
							<div class="form-actions">
								<input  id="in" class="btn btn-block btn-primary btn-default" value="登录">
                            </div>
                            <br/>
							<div class="form-actions">
								<input  id="in2" class="btn btn-block btn-primary btn-default" value="专家入口">
                            </div>
						</form>
					</div>
				</div>
			</div>
		</div>
<script>

    $("#in").click(function () {
        login();
    });
    $("#in2").click(function () {
        login2();
    });

    function login2(){
        $.ajax({
            type: 'post',
            async: false,
            url: "/expertsEntrance",
            success: function (reslut) {
                console.log(reslut);
                if (reslut.data === "ok"){
                    window.location.href = "/home";
                }else{
                    toastr.info(reslut.msg);
                }
            }
        });
    }

    function login(){
        $.ajax({
            type: 'post',
            async: false,
            url: "/login2",
            data: {
                "password": $("#password").val(),
                "username": $("#username").val()
            },
            success: function (reslut) {
                console.log(reslut);
                if (reslut.data === "ok"){
                    window.location.href = "/home";
                }else{
                    toastr.info(reslut.msg);
                }
            }
        });
    }

    // var queryVariable = getQueryVariable("token");
    // console.log(queryVariable);
    // $.ajax({
    //     type: 'post',
    //     async: false,
    //     url: "/index.html",
    //     data: {
    //         "token": queryVariable,
    //     },
    //     success: function (reslut) {
    //         if (reslut.msg === "false"){
    //         }
    //     }
    // });
    function getQueryVariable(variable)
    {
        var query = window.location.search.substring(1);
        var vars = query.split("&");
        for (var i=0;i<vars.length;i++) {
            var pair = vars[i].split("=");
            if(pair[0] === variable){return pair[1];}
        }
        returnfalse;
    }
</script>
	</body>
</html>
